﻿@page "/FileTree"

<div>
  <PageHeader Title="File Tree" />
  <Search AllowClear="true" @bind-Value="this.SearchKey" Placeholder="Search.." />
  <Layout>
    <Sider Width="400">
      <Tree DataSource="this.MyDirectories"
            SearchValue="@this.SearchKey"
            TitleExpression="x=>x.DataItem.Name"
            IconExpression="x=>x.DataItem.Icon"
            ChildrenExpression="x => x.DataItem.Children"
            IsLeafExpression='x => x.DataItem.Type.Equals("file")'
            OnNodeLoadDelayAsync="this.OnLoadDirectoryAsync"
            SelectedDataChanged="this.SelectedDataChanged"
            TItem="MyDirectory"></Tree>
    </Sider>
    <Layout Class="child-layout">
      @if (this.ActiveFile != null)
      {
        <FilePreview MyFile="this.ActiveFile" />
      }
    </Layout>
  </Layout>
</div>